<?php

/**
 * SeguridadHigiene filter form base class.
 *
 * @package    sf_sandbox
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseSeguridadHigieneFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'nro'                => new sfWidgetFormFilterInput(),
      'mbk'                => new sfWidgetFormFilterInput(),
      'piso'               => new sfWidgetFormFilterInput(),
      'dpto'               => new sfWidgetFormFilterInput(),
      'nro_inscripcion'    => new sfWidgetFormFilterInput(),
      'razon_social'       => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'superficie'         => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'fecha_habilitacion' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'calle_id'           => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Calle'), 'add_empty' => true)),
      'barrio_id'          => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Barrio'), 'add_empty' => true)),
    ));

    $this->setValidators(array(
      'nro'                => new sfValidatorPass(array('required' => false)),
      'mbk'                => new sfValidatorPass(array('required' => false)),
      'piso'               => new sfValidatorPass(array('required' => false)),
      'dpto'               => new sfValidatorPass(array('required' => false)),
      'nro_inscripcion'    => new sfValidatorPass(array('required' => false)),
      'razon_social'       => new sfValidatorPass(array('required' => false)),
      'superficie'         => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'fecha_habilitacion' => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'calle_id'           => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Calle'), 'column' => 'id')),
      'barrio_id'          => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Barrio'), 'column' => 'id')),
    ));

    $this->widgetSchema->setNameFormat('seguridad_higiene_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'SeguridadHigiene';
  }

  public function getFields()
  {
    return array(
      'id'                 => 'Number',
      'nro'                => 'Text',
      'mbk'                => 'Text',
      'piso'               => 'Text',
      'dpto'               => 'Text',
      'nro_inscripcion'    => 'Text',
      'razon_social'       => 'Text',
      'superficie'         => 'Number',
      'fecha_habilitacion' => 'Date',
      'calle_id'           => 'ForeignKey',
      'barrio_id'          => 'ForeignKey',
    );
  }
}
